package File;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Demo13 {
    public static void main(String[] args) throws FileNotFoundException {
        File file = new File("test.txt");

        try(InputStream inputStream = new FileInputStream(file)) {
            Scanner scanner = new Scanner(file, StandardCharsets.UTF_8);//读取汉字
            while (scanner.hasNext()) {
                String str = scanner.next();
                System.out.print(str);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
